<template>
  <Main>
    <div class="login">
      <div class="content">
        <p class="title">PASS云&nbsp;|&nbsp;登录</p>
        <a-form class="form" :form="form" @submit="handleSubmit">
          <a-form-item v-bind="formItemLayout" label="用户名">
            <a-input v-decorator="['username']" />
          </a-form-item>
          <a-form-item v-bind="formItemLayout" label="密码" has-feedback>
            <a-input type="password" v-decorator="['password']" />
          </a-form-item>
          <a-form-item v-bind="tailFormItemLayout">
            <a-checkbox
              v-decorator="['agreement', { valuePropName: 'checked' }]"
            >
              我已经阅读
              <a href=""> PASS平台条款 </a>
            </a-checkbox>
          </a-form-item>
          <a-form-item v-bind="tailFormItemLayout">
            <a-button type="primary" html-type="submit"> 登录 </a-button>
          </a-form-item>
        </a-form>
      </div>
      <Bg2 />
    </div>
  </Main>
</template>

<script>
import Main from "@/components/Main.vue";
import Bg2 from "@/components/svg/Bg2.vue";

export default {
  name: "Login",
  components: {
    Main,
    Bg2,
  },
  data() {
    return {
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 8 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
      },
      tailFormItemLayout: {
        wrapperCol: {
          xs: {
            span: 24,
            offset: 0,
          },
          sm: {
            span: 16,
            offset: 8,
          },
        },
      },
    };
  },
  methods: {
    handleSubmit(e) {
      e.preventDefault();
      this.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          console.log("Received values of form: ", values);
        }
      });
    },
  },
  beforeCreate() {
    this.form = this.$form.createForm(this, { name: "register" });
  },
};
</script>

<style lang="less" scoped>
.login {
  width: 90%;
  height: 600px;
  max-width: 1500px;
  margin: 0 auto;
  overflow: hidden;

  .content {
    width: 550px;
    height: 500px;
    background-color: #ffffff;
    box-shadow: 10px 10px 10px #888888;
    display: inline;
    margin-top: 80px;
    float: right;
    margin-right: 20px;

    .title {
      float: left;
      width: 400px;
      font-size: 35px;
      font-weight: 600;
      padding-top: 80px;
      margin-left: 50px;
      margin-bottom: 50px;
    }

    .form {
      width: 400px;
    }
  }
}
</style>